<template>
  <div>
    <!-- 分页复用组件说明 -->

    <!-- 需要传递两个数据  -->
  <!-- <myPaging :queryInfo="" :getListData=""></myPaging> -->

    <!-- 1. queryInfo: { 
          查询条件 通过绑定分页会动态改变 从而执行请求新的数据
          total: 0,
          size: 10,
          page: 1
    }-->

    <!-- 2. getListData() {
            请求网络的函数  内部需要请求新的数据 从而在改变页数时刷新新的数据
    }-->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :background="true"
      layout="total, prev, pager, next, sizes, jumper"
      :current-page="queryInfo.page"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="queryInfo.size"
      :total="queryInfo.total"
    ></el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  mounted() {},
  methods: {
    handleSizeChange(newSize) {
      this.queryInfo.size = newSize;
      this.getListData();
    },
    handleCurrentChange(newPage) {
      this.queryInfo.page = newPage;
      this.getListData();
    }
  },
  props: ["queryInfo", "getListData"]
};
</script>

<style lang="less" scoped>
.el-pagination {
  margin-top: 25px;
}
</style>